package com.luoye.unionlotto;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Application {
    public static void main(String args[]){
        System.out.println("hello!");
        //UnionlottoFromNetAnalyzer unionlottoAnalyzer=new UnionlottoFromNetAnalyzer("http://kaijiang.zhcw.com/zhcw/inc/ssq/ssq_wqhg.jsp","D:\\download\\unionlotto");
        //UnionlottoFromFileAnalyzer unionlottoAnalyzer=new UnionlottoFromFileAnalyzer("D:\\\\download\\\\unionlotto");
//        UnionlottoFromFileAndNetAnalyzer unionlottoAnalyzer=new UnionlottoFromFileAndNetAnalyzer("D:\\\\download\\\\unionlotto","http://kaijiang.zhcw.com/zhcw/inc/ssq/ssq_wqhg.jsp");
//        unionlottoAnalyzer.analyze();

        //算奖
//        WinningAnalyzer winningAnalyzer=new WinningAnalyzer("D:\\\\download\\\\unionlotto","http://kaijiang.zhcw.com/zhcw/inc/ssq/ssq_wqhg.jsp");
//        winningAnalyzer.analyze();
        System.out.println(getCurrentDate());
    }


    public static String getCurrentDate(){
        //计算日期
        Date now=new Date();
        Calendar cal = Calendar.getInstance();
        cal.setTime(now);
        int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
        System.out.println(w);
        int d=0;
        if(w>0&&w<=2){//星期2的
            d=2-w;
        }else if(w>2&&w<=4){//星期4的
            d=4-w;
        }else if(w>4){//星期天
            d=7-w;
        }
        System.out.println(d);
        cal.add(Calendar.DATE,d);
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String date=dateFormat.format(cal.getTime());
        return date;
    }
}
